package data

import (
	"fcs-api/src/app/model"
	"log"
)

func GetDimensionValues(dimension []string, metricTarget, resourceId, status string) map[string]string {
	dimensionsValue := make(map[string]string)

	/*
		@param  dimension  []string
		@param  metricResourceId string
		@param	metricType string
		@return  map[string]string
		TODO
	*/
	//dimensionsValue = metricData.GetDimensionsValue(dimension, metricTarget, metricType)
	if metricTarget == "service_instance_status" {
		f, err := model.GetFuncInfoById(resourceId)
		if err != nil {
			log.Println("get func info err ", err)
			return dimensionsValue
		}
		dimensionsValue[dimension[0]] = f.CreatorName
		dimensionsValue[dimension[1]] = f.RegionCode
		dimensionsValue[dimension[3]] = f.FunctionName
		dimensionsValue[dimension[4]] = status
	}else {
		dimensionsValue[dimension[0]] = ""
		dimensionsValue[dimension[1]] = model.Base.Region
		dimensionsValue[dimension[3]] = "fcs"
		dimensionsValue[dimension[4]] = status
	}

	return dimensionsValue
}
